/**
 * Created by wangshaohua on 2017/8/28.
 */

var sz_ConnectionHelper = {
    connectionType: function () {
        var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
        if (connection) {
            var networkState = connection.type;
            var states = {};
            // states[Connection.UNKNOWN] = 'Unknown';//未知连接
            // states[Connection.ETHERNET] = 'Ethernet';//以太网
            // states[Connection.WIFI] = 'WiFi';//wifi
            // states[Connection.CELL_2G] = '2G';//2G
            // states[Connection.CELL_3G] = '3G';//3G
            // states[Connection.CELL_4G] = '4G';//4G
            // states[Connection.CELL] = 'Cell generic';//蜂窝网络
            // states[Connection.NONE] = 'No network';

            //alert('Connection type: ' + states[networkState]);
            return networkState;
        } else {
            return null;
        }
    }
}

